const si = require('node-machine-id');
const crypto = require('crypto');

/**
 * 获取唯一机器码
 * @returns 返回MD5加密后的唯一机器码
 */
async function getMachineId() {
  const id = await si.machineId();
  const md5 = crypto.createHash('md5');
  md5.update(id);
  return md5.digest('hex').toLocaleUpperCase();
}

module.exports = getMachineId;